package com.tender.fallback;

import com.tender.request.HelloReq;
import lombok.extern.slf4j.Slf4j;
import com.tender.HelloApi;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import com.tender.common.Result;


@Component
@Slf4j
public class HelloApiFallback implements FallbackFactory<HelloApi> {

    @Override
    public HelloApi create(Throwable cause) {

        log.error("==> HelloApi 调用异常,错误原因为: {}, error: ", cause.getMessage(), cause);

        return new HelloApi() {
            @Override
            public Result<String> hello(HelloReq param) {
                return null;
            }
        };
    }
}
